/* -+- file  ./kf2/GUI/StatusDialog.cs -+- */
/*
 * kf2 jabber client
 * ~~~~~~~~~~~~~~~~~
 *
 * Copyright (C) 2006-2007 Przemysław Sitek
 * 				<przemyslaw.sitek at wp.pl> 
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

using System;
using Habazie.kf2.Core;

namespace Habazie.kf2.GUI
{
	///<summary>Dialog that asks for status message</summary>
	public class StatusDialog : Gtk.Dialog
	{
		#region Private fields
		
		private App m_App = null;
		private jabber.protocol.client.PresenceType m_Presence;
		private string m_Show = null;
		private string m_To = null;
		protected Gtk.TextView m_Status;
		
		#endregion
		#region Constructors
		
		public StatusDialog()
		{
			Stetic.Gui.Build(this, typeof(Habazie.kf2.GUI.StatusDialog));
		}
		
		public StatusDialog (App app,
							jabber.protocol.client.PresenceType presence,
							string show) : this ()
		{
			m_App = app;
			m_Presence = presence;
			m_Show = show;
		}
		
		#endregion
		#region Event handlers

		protected virtual void OnCancelClicked(object sender, System.EventArgs e)
		{
			this.Destroy ();
		}

		protected virtual void OnOKClicked(object sender, System.EventArgs e)
		{
			ConnectionManager c = m_App.Connections;
			string status = m_Status.Buffer.Text;
			
			c.Presence (m_Presence, status, m_Show);
			
			this.Destroy ();
		}
		
		#endregion
		#region Properties
		
		public string To {
			get { return m_To; }
			set { m_To = value; }
		}
		
		#endregion
	}
	
}
